import request from '@/src/basic/utils/request.js'

function handleParams(param) {
  let paramsUrl = ''
  for (const item in param) {
    let val = param[item]
    let str = `${item}=${val}&`
    paramsUrl += str
  }
  paramsUrl = paramsUrl.slice(0, paramsUrl.length - 1)
  return paramsUrl
}

export const getGoods = async params => {
  const { data } = await request.get(`/merchant/app/multiIndustryOrder/commodityQueryOrder`, params)
  return data
}
export const getYdGoods = async params => {
  const { data } = await request.get(`/merchant/app/multiIndustryReceive/receiveList`, params)
  return data
}

export const changeOrderState = async params => {
  const { data } = await request.get(`/merchant/app/multiIndustryOrder/orderState?${handleParams(params)}`)
  return data
}
export const apiGetToken = async params => {
  const { data } = await request.get(`/auth/token/refresh/${params}`)
  return data
}
